package com.ruoyi.business.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.security.annotation.EnterpriseAndApplicationCodeProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.business.domain.SysComponentParameters;
import com.ruoyi.business.service.ISysComponentParametersService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 系统组件参数Controller
 * 
 * @author ruoyi
 * @date 2025-11-18
 */
@RestController
@RequestMapping("/sysComponentParameters")
public class SysComponentParametersController extends BaseController
{
    @Autowired
    private ISysComponentParametersService sysComponentParametersService;

    /**
     * 查询系统组件参数列表
     */
    @RequiresPermissions("business:sysComponentParameters:list")
    @GetMapping("/list")
    public TableDataInfo list(SysComponentParameters sysComponentParameters)
    {
        startPage();
        List<SysComponentParameters> list = sysComponentParametersService.selectSysComponentParametersList(sysComponentParameters);
        return getDataTable(list);
    }

    /**
     * 导出系统组件参数列表
     */
    @RequiresPermissions("business:sysComponentParameters:export")
    @Log(title = "系统组件参数", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysComponentParameters sysComponentParameters)
    {
        List<SysComponentParameters> list = sysComponentParametersService.selectSysComponentParametersList(sysComponentParameters);
        ExcelUtil<SysComponentParameters> util = new ExcelUtil<SysComponentParameters>(SysComponentParameters.class);
        util.exportExcel(response, list, "系统组件参数数据");
    }

    /**
     * 获取系统组件参数详细信息
     */
    @RequiresPermissions("business:sysComponentParameters:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysComponentParametersService.selectSysComponentParametersById(id));
    }

    /**
     * 新增系统组件参数
     */
    @RequiresPermissions("business:sysComponentParameters:add")
    @Log(title = "系统组件参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@EnterpriseAndApplicationCodeProperty SysComponentParameters sysComponentParameters)
    {
        return toAjax(sysComponentParametersService.insertSysComponentParameters(sysComponentParameters));
    }

    /**
     * 修改系统组件参数
     */
    @RequiresPermissions("business:sysComponentParameters:edit")
    @Log(title = "系统组件参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@EnterpriseAndApplicationCodeProperty SysComponentParameters sysComponentParameters)
    {
        return toAjax(sysComponentParametersService.updateSysComponentParameters(sysComponentParameters));
    }

    /**
     * 删除系统组件参数
     */
    @RequiresPermissions("business:sysComponentParameters:remove")
    @Log(title = "系统组件参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysComponentParametersService.deleteSysComponentParametersByIds(ids));
    }
}
